//
//  InspectionDetailController.m
//  PropertyMananger
//
//  Created by Mansion on 17/1/21.
//  Copyright © 2017年 BH. All rights reserved.
//

#import "InspectionDetailController.h"
#import "InspectionDetailCell.h"
#import "InspectionContentCell.h"

@interface InspectionDetailController ()

@property (nonatomic,strong) NSArray * titleArr;
@property (nonatomic,strong) NSMutableArray * dataSource;
@end

@implementation InspectionDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initTitleViewName:@"巡检详情"];
    
    [self initTableViewWithView:self.view frame:CGRectMake(0, 0, BHscreenW, BHscreenH - 64) isGroup:NO];
    
    self.titleArr = @[@"记录时间",@"记录人"];
    self.dataSource = [[NSMutableArray alloc]initWithObjects:self.model.InspectTime,self.model.InspectMan, nil];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    return 3;

}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    if (indexPath.row == 0 || indexPath.row == 1) {
        
        InspectionDetailCell * cell = [InspectionDetailCell cellWithTableView:tableView];
        cell.titleLabel.text = self.titleArr[indexPath.row];
        cell.contentLabel.text = self.dataSource[indexPath.row];
        return cell;
        
    }else if (indexPath.row == 2){
        
        InspectionContentCell * cell = [InspectionContentCell cellWithTableView:tableView];
        cell.model = self.model;
        return cell;
    }
    return nil;

}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0 || indexPath.row == 1) {
        
        return 50;
        
    }else if (indexPath.row == 2){
    
        return [InspectionContentCell MyInspectContentHeightWiht:self.model];
    }
    return 50;
}

@end
